import Vue from 'vue'
import VueRouter from 'vue-router'
// 导入各个组件
import Layout from '@/views/layout'
import Login from '@/views/login'
import NotFound from '@/views/404'
// 二级
import Home from '@/views/layout/home'
import Qa from '@/views/layout/Qa'
import User from '@/views/layout/user'
import Video from '@/views/layout/video'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [
      {
        path: 'home',
        component: Home
      },
      {
        path: 'Qa',
        component: Qa
      },
      {
        path: 'video',
        component: Video
      },
      {
        path: 'user',
        component: User
      }
    ]
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '*',
    component: NotFound
  }
]

const router = new VueRouter({
  routes
})

export default router
